<div id="projectContainer" class="nav nav_vertical">
<?php
	$_GET['prefix'] = 'prj';
	if (!isset($_GET['ctg_id'])) {
		$_GET['ctg_id'] = $active_ctg_id;
	}
	include 'lib/php/load.php';
	ob_end_clean();
	$projects = $items;
	$i = 0;
	foreach ($projects as $id => $item) {
		if(isset($_GET['prj_id'])) {
			if($id == $_GET['prj_id']) {
				$active_prj_id = $id;
				displayPrj($id, $item, true);
			} else {
				displayPrj($id, $item, false);
			}
		} else {
			displayPrj($id, $item, false);
		}
		$i++;
		
	}
?>
</div>

<?php 
function displayPrj($id, $item, $active){
	$prefix = $item[prefix];
	$div_id = $prefix."_".$id;
	$class = $active == true ? "item prj active" : "item prj";
	$alias = $item[alias];
	$label = $item[label];
	$thumb = $item[thumb];
	$thumb_enable = $item[thumb_enable];
	$top = 80*$item[position];
	$ctg = $item[category_id];
	$html = array("<div id=\"$div_id\" class=\"$class\" style=\"top:".$top."px;\">
	<a id=\"innerlink_$div_id\" class=\"link\" href=\"index.php?prefix=$prefix&amp;ctg_id=$ctg&amp;prj_id=$id\"></a>\n");
	if($label != "") 					array_push($html, "	<div id=\"label_$div_id\" class=\"label\">$label</div>\n");
	if($thumb != "" && $thumb_enable) 	array_push($html, "	<img id=\"thumb_$div_id\" class=\"thumb\" src=\"$thumb\" alt=\"$alias\" width=\"73\" height=\"73\" />\n");
	array_push($html, "</div>");
	echo join('', $html);
}
?>